home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
001
/
pibt3sp1.arc
/
FASTCHNG.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-08-11
|
5KB
|
120 lines
(*----------------------------------------------------------------------*)
(* Fast_Change_Params --- fast change of communications params. *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Fast_Change_Params;
(*----------------------------------------------------------------------*)
(* *)
(* Procedure: Fast_Change_Params *)
(* *)
(* Purpose: Fast change of communications params *)
(* *)
(* Calling Sequence: *)
(* *)
(* Fast_Change_Params; *)
(* *)
(* *)
(* Remarks: *)
(* *)
(* This routine is useful is making a fast switch between *)
(* the parameter values needed by XMODEM and those required *)
(* by the remote host. *)
(* *)
(*----------------------------------------------------------------------*)
CONST
Comm_Parities : ARRAY[ 1 .. 6 ] OF CHAR = ('E','N','O','E','N','O');
Comm_Data_Bits : ARRAY[ 1 .. 6 ] OF INTEGER = ( 7, 7, 7, 8, 8, 8 );
Baud_Rates: ARRAY[ 1 .. 8 ] OF INTEGER
= ( 110, 150, 300, 600, 1200, 2400, 4800, 9600 );
VAR
Comm_Parms_Menu : Menu_Type;
Baud_Menu : Menu_Type;
Comm_Parms : INTEGER;
I : INTEGER;
BEGIN (* Fast_Change_Params *)
Comm_Parms_Menu.Menu_Size := 6;
Comm_Parms_Menu.Menu_Row := 11;
Comm_Parms_Menu.Menu_Column := 30;
Comm_Parms_Menu.Menu_Tcolor := Menu_Text_Color;
Comm_Parms_Menu.Menu_Bcolor := BackGround_Color;
Comm_Parms_Menu.Menu_Fcolor := Menu_Frame_Color;
Comm_Parms_Menu.Menu_Width := 0;
Comm_Parms_Menu.Menu_Height := 0;
Comm_Parms_Menu.Menu_Default := ( Data_Bits - 7 ) * 3 + POS( Parity, 'ENO' );
FOR I := 1 TO 6 DO
WITH Comm_Parms_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := 'a) Even parity, 7 bits, 1 stop';
2: Menu_Item_Text := 'b) No parity, 7 bits, 1 stop';
3: Menu_Item_Text := 'c) Odd parity, 7 bits, 1 stop';
4: Menu_Item_Text := 'd) Even parity, 8 bits, 1 stop';
5: Menu_Item_Text := 'e) No parity, 8 bits, 1 stop (Xmodem)';
6: Menu_Item_Text := 'f) Odd parity, 8 bits, 1 stop';
END (* CASE *);
END;
Comm_Parms_Menu.Menu_Title := 'Choose new communications parameters: ';
Menu_Display_Choices( Comm_Parms_Menu );
Comm_Parms := Menu_Get_Choice( Comm_Parms_Menu , Erase_Menu );
Parity := Comm_Parities [ Comm_Parms ];
Data_Bits := Comm_Data_Bits[ Comm_Parms ];
(* Get Baud Rate *)
Baud_Menu.Menu_Size := 8;
Baud_Menu.Menu_Row := 11;
Baud_Menu.Menu_Column := 30;
Baud_Menu.Menu_Tcolor := Menu_Text_Color;
Baud_Menu.Menu_Bcolor := BackGround_Color;
Baud_Menu.Menu_Fcolor := Menu_Frame_Color;
Baud_Menu.Menu_Width := 0;
Baud_Menu.Menu_Height := 0;
CASE Baud_Rate Of
110 : Baud_Menu.Menu_Default := 1;
150 : Baud_Menu.Menu_Default := 2;
300 : Baud_Menu.Menu_Default := 3;
600 : Baud_Menu.Menu_Default := 4;
1200: Baud_Menu.Menu_Default := 5;
2400: Baud_Menu.Menu_Default := 6;
4800: Baud_Menu.Menu_Default := 7;
9600: Baud_Menu.Menu_Default := 8;
END (* CASE *);
FOR I := 1 to 8 DO
With Baud_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I Of
1: Menu_Item_Text:= 'a) 110';
2: Menu_Item_Text:= 'b) 150';
3: Menu_Item_Text:= 'c) 300';
4: Menu_Item_Text:= 'd) 600';
5: Menu_Item_Text:= 'e) 1200';
6: Menu_Item_Text:= 'f) 2400';
7: Menu_Item_Text:= 'g) 4800';
8: Menu_Item_Text:= 'h) 9600';
END (* CASE *);
END;
Baud_Menu.Menu_Title := 'Choose Baud Rate: ';
Menu_Display_Choices( Baud_Menu );
Baud_Rate := Baud_Rates[ Menu_Get_Choice( Baud_Menu , Erase_Menu ) ];
Async_Reset_Port( Comm_Port, Baud_Rate, Parity, Data_Bits, 1 );
END (* Fast_Change_Params *);